<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>猪油骨的首页</title>
    <link rel="icon" href="/static/images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/static/dist/semantic/semantic.min.css">
    <link rel="stylesheet" href="/static/css/me.css">
    <link rel="stylesheet" href="/static/lib/animate/animate.css">
</head>
<body>
    <!-- 导航 -->
    <section id="home">
        <nav  class="ui segment attached m-padded-tb-mini m-background-small" style="z-index: 2" th:replace="_fragments :: menu(1)">
            <div class="ui secondary stackable menu m-margin-tb-mini">
                <h2 class="ui brown header item m-padded-mini">猪油骨</h2>
                <a href="#" class="right m-item item m-mobile-hide m-padded-tb-small"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-shouye"></use>
                </svg>首页</a>
                <a href="#" class="m-item item m-mobile-hide m-color m-padded-tb-small"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-fenlei1"></use>
                </svg> 分类</a>
                <a href="#" class="m-item item m-mobile-hide  m-padded-tb-small"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-_biaoqian"></use>
                </svg> 标签</a>
                <a href="#" class="m-item item m-mobile-hide  m-padded-tb-small"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-guidangrizhi"></use>
                </svg>归档</a>
                <a href="#" class="m-item item m-mobile-hide  m-padded-tb-small"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-guanyuwomen2"></use>
                </svg>关于我</a>
                <a href="#" class="ui button m-item item m-mobile-hide m-padded-mini"><svg class="icon1" aria-hidden="true">
                    <use xlink:href="#icon-sousuo1"></use>
                </svg>搜索</a>
            </div>
            <div class="ui modal m-container-mini">
                <i class="close icon"></i>
                <h2 class="ui grey header item ">请输入搜索内容</h2>
                <div class=" ui right icon input">
                    <input type="text" placeholder="搜索....">
                    <i class="search link icon"></i>
                </div>
            </div>
            </div>
            <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show"
               style="background: rgba(255,255,255,0.5)"><i class="sidebar icon"></i></a>
        </nav>
        <div class="inner-width animated zoomIn">
            <div class="content">
                <div>
                    <h2 class="m-weight-none waypoint1">猪油骨</h2>
                    <h3 class="m-weight-none">细枝末节累积起来，即是生活。</h3>
                </div>
                <div class="buttons">
                    <a  href="#container">进入首页</a>
<!--                    <a  th:href="@{/types/-1}" href="#container">分类</a>-->
<!--                    <a  th:href="@{/tags/-1}" href="#container">标签</a>-->
<!--                    <a  th:href="@{/archives/}" href="#container">归档</a>-->
<!--                    <a  th:href="@{/about/}" href="#container">关于我</a>-->
                </div>
            </div>
        </div>
    </section>
    <!-- 中间 -->
    <div id="container" class="m-container m-padded-tb-big waypoint2">
        <div class="ui container">
            <div class="ui stackable grid">
                <!-- 左边博客列表 -->
                <div class="wide column">
                    <!--content-->
                    <div class="ui segment m-transition" th:each="blog : ${page.content}">
                        <div class="ui padded vertical segment m-padded-tb-large">
                            <!--grid:分成16份、mobile reversed:手机端反转,原来图片在下方(eleven在下,five在上)、stackable:可堆叠,屏幕小的时候会堆叠到一块,用于适应移动端网页适配-->
                            <div class="ui middle mobile reversed stackable grid">
                                <div class="eleven wide column">
                                    <h3 class="ui header"><a href="#" th:href="@{/blog/{id}(id=${blog.id})}"
                                                             target="_blank" class="m-black" th:text="${blog.title}">你真的理解什么是财富自由吗?</a>
                                    </h3>
                                    <p class="m-text" th:text="|${blog.description}......|">
                                        正确做好任何一件事情的前提是清晰、正确的理解目标。而事实是，我们很多人很多时候根本没有对目标正确的定义，甚至根本从来就没有想过，只是大家都那么做而已…...
                                    </p>
                                    <div class="ui grid">
                                        <div class="eleven wide column">
                                            <!--horizontal:平着的、mini:小一点-->
                                            <div class="ui mini horizontal link list">
                                                <div class="item">
                                                    <!--avatar image:圆形的图片-->
                                                    <img src="https://picsum.photos/id/1027/100/100"
                                                         th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image">
                                                    <div class="content"><a herf="#" class="header"
                                                                            th:text="${blog.user.nickname}">CodeSleep</a></div>
                                                </div>
                                                <div class="item">
                                                    <!--calendar icon:时间的图标-->
                                                    <i class="calendar icon"></i><span
                                                        th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2020/10/1</span>
                                                </div>
                                                <div class="item">
                                                    <!--eye icon:眼睛的图标-->
                                                    <i class="eye icon"></i><span th:text="${blog.views}">2200</span>
                                                </div>
                                            </div>
                                        </div>
                                        <!--right aligned:靠右、orange:颜色、basic:边线试感觉-->
                                        <div class="right aligned five wide column">
                                            <a href="#" target="_blank"
                                               class="ui orange basic label m-padded-tiny m-text-thin"
                                               th:text="${blog.type.name}">认知升级</a>
                                        </div>
                                    </div>
                                </div>

                                <div class="five wide column">
                                    <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                        <!--rounded:圆角的-->
                                        <img src="https://picsum.photos/id/16/800/450" th:src="@{${blog.firstPicture}}"
                                             alt="" class="ui rounded image">
                                    </a>
                                </div>

                            </div>
                        </div>

                    </div>
                    <!--footer-->
                    <div class="ui bottom  segment" th:if="${page.totalPages}>1">
                        <!--middle aligned:垂直方向居中、two:一左一右-->
                        <div class="ui middle aligned two column grid">
                            <div class="column">
                                <!--button:ui默认的button按钮、orange:颜色、basic:中间透明-->
                                <a href="#" th:href="@{/(page=${page.number}-1)}" th:unless="${page.first}"
                                   class="ui mini orange basic button">上一页</a>
                            </div>
                            <div class="right aligned column">
                                <!--button:ui默认的button按钮、orange:颜色、basic:中间透明-->
                                <a href="#" th:href="@{/(page=${page.number}+1)}" th:unless="${page.last}"
                                   class="ui mini orange basic button">下一页</a>
                            </div>
                        </div>
                    </div>
                </div>
                <!--右边的top-->
            </div>
        </div>
    </div>
    <div id="message" class=" m-container-mini m-mobile-hide-lage m-fixed m-right" style="display: none">
        <div class="column">
            <div class="ui segment">
                <img th:each="item : ${users}"  th:src="@{${item.getAvatar()}}" src="http://iph.href.lu/100x100?text=头像" alt="" class="ui circular image"
                     style="margin: auto">
                <h2 style="text-align: center;" class="m-weight-none m-black-1" th:each="item : ${users}" th:text="${item.nickname}">猪油骨</h2>
                <p class="m-black-1">人总要走在路上，才能扶着自己成长。</p>
            </div>
            <div class="ui middle segment aligned three column centered divided grid">
                <a href="#container">
                    <div>文章
                        <svg class="icon1" aria-hidden="true">
                            <use xlink:href="#icon-wenzhang"></use>
                        </svg>
                    </div>
                    <div class="m-orange m-padded-tb-small" style="font-weight: bold"
                         th:text="${#arrays.length(page.content)}">1</div>
                </a>
                <a href="#" th:href="@{types/-1}" target="_blank">
                    <div>
                        分类
                        <svg class="icon1" aria-hidden="true">
                            <use xlink:href="#icon-fenlei1"></use>
                        </svg>
                    </div>
                    <div class="m-orange m-padded-tb-small" style="font-weight: bold"
                         th:text="${#arrays.length(types)}">1</div>
                </a>
                <a href="#" th:href="@{tags/-1}" target="_blank">
                    <div>标签<svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-_biaoqian"></use>
                    </svg>
                    </div>
                    <div class="m-orange m-padded-tb-small" style="font-weight: bold"
                         th:text="${#arrays.length(tags)}">1</div>
                </a>
            </div>
            <div class="ui segments m-margin-top-large">
                <div class="ui secondary segment">
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-tuijianfuwu"></use>
                    </svg>推荐
                </div>
                <div class="ui segment m-text-thin"  th:each="blog : ${recommendBlogs}">
                    <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black" th:text="${blog.title}">用户故事(User Story)</a>
                </div>
            </div>
        </div>
    </div>
    <br>
    <br>
    <br>
    <!-- 底部 -->
    <footer class="ui inverted vertical segment m-padded-tb-small m-position-bottom" th:replace="_fragments :: footer"
            style="background: rgba(0,0,0,0.5)">
        <div class="ui center aligned container">
            <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright © 2022 猪油骨</p>
            <a href="http://beian.miit.gov.cn/" target="_blank"
               class="m-text-thin m-text-spaced m-opacity-tiny">桂ICP备2022010618号</a>
        </div>
    </footer>
    <!--/*/<th:block th:replace="_fragments :: script">/*/-->
        <script src="../static/dist/jquery/jquery-3.6.0.min.js"></script>
        <script src="../static/dist/semantic/semantic.min.js" ></script>
    <!--/*/</th:block>/*/-->

    <script>
        // $('.menu.toggle').click(function () {
        //     $('.m-item').toggleClass('m-mobile-hide');
        // })
        // $(function () {
        //     $(".ui.button.m-item").on("click", function () {
        //         $(".ui.modal").modal("show");
        //     })
        // })
        $(document).ready(function () {
            $(window).scroll(function () {
                if (this.scrollY > 20)
                    $(".navbar").addClass("sticky");
                else
                    $(".navbar").removeClass("sticky");
            });

            $('.menu-toggler').click(function () {
                $(this).toggleClass("active");
                $(".navbar-menu").toggleClass("active");
            });
        });

        const waypoint2 = new Waypoint({
            // element: document.getElementsByClassName('waypoint1'),
            // handler: function (direction) {
            //     if (direction == 'down') {
            //         $('#nav').show(500);
            //     } else {
            //         $('#nav').hide(500);
            //     }
            //     console.log('Scrolled to waypoint!' + direction);
            // }
            element: document.getElementsByClassName('waypoint2'),
            handler: function (direction) {
                if (direction == 'down') {
                    $('#message').show(300);
                } else {
                    $('#message').hide(300);
                }
                console.log('Scrolled to waypoint!' + direction);
            }
        });
        $('#toTop-button').click(function () {
            $(window).scrollTo(0,500);
        });


    </script>

</body>

</html>
